package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.AccountLogEntity;
import com.lx.oms.controller.manager.AccountLogManager;
import com.lx.oms.controller.service.AccountLogService;

/**
 * 账户余额日志
 *
 * @author houzhong
 * @date 2018年10月30日 下午2:03:26
 */
@Service("accountLogService")
public class AccountLogServiceImpl implements AccountLogService {

	@Autowired
	private AccountLogManager accountLogManager;

	@Override
	public Page<AccountLogEntity> listAccountLog(Map<String, Object> params) {
		Query query = new Query(params);
		Page<AccountLogEntity> page = new Page<>(query);
		accountLogManager.listAccountLog(page, query);
		return page;
	}

	@Override
	public R saveAccountLog(AccountLogEntity role) {
		int count = accountLogManager.saveAccountLog(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getAccountLogById(BigInteger id) {
		AccountLogEntity tAccountLog = accountLogManager.getAccountLogById(id);
		return CommonUtils.msg(tAccountLog);
	}

	@Override
	public R updateAccountLog(AccountLogEntity tAccountLog) {
		int count = accountLogManager.updateAccountLog(tAccountLog);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = accountLogManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
